// const deepHandle = (o) => {
//   let ret = Object.prototype.toString.call(o) === '[object Object]' ? {} : []
//   for (let j in o) {
//     // console.log(o[j])
//     if (typeof o[j] !== 'object') {
//       ret[j] = o[j]
//     } else {
//       ret[j] = deepHandle(o[j])
//     }
//   }

//   return ret
// }
let deepHandle = function(obj) {
  let copy = Object.create(Object.getPrototypeOf(obj));
  let propNames = Object.getOwnPropertyNames(obj);
  propNames.forEach(function(items) {
    let item = Object.getOwnPropertyDescriptor(obj, items);
    Object.defineProperty(copy, items, item);

  });
  return copy;
};


let obj = {
  a: '1',
  b: '2',
  c: {
    e: '1',
    c: '2'
  }
}
let arr = [1, 2, [1, 2, 3, 4, 5, 6]]

let isTestArr = false
if (isTestArr) {
  const deepObj = deepHandle(arr)
  deepObj[2][2] = 'ass'
  console.log(arr)
  console.log(deepObj)
} else {
  const deepObj = deepHandle(obj)
  deepObj.c.e = 'ass'
  console.log(obj)
  console.log(deepObj)
}